//
//  BtnCollectionViewCell.m
//  quxiangtao
//
//  Created by xbmios on 2018/7/4.
//  Copyright © 2018年 shanhaijin. All rights reserved.
//

#import "BtnCollectionViewCell.h"

@interface BtnCollectionViewCell ()

//@property (strong, nonatomic) UILabel *nameL;
//@property (strong, nonatomic) UIImageView *iconIV;

@end

@implementation BtnCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    
    if (self) {
        
        [self.contentView addSubview:self.nameL];
        [self.contentView addSubview:self.iconIV];
        
    }
    
    return self;
}

//- (void)setModel:(TbCategoryTitleModel *)model {
//    
//    _model = model;
//    
//    self.nameL.text = model.classname;
//    
////    [self.iconIV sd_setImageWithURL:[NSURL URLWithString:model.]];
//    
//}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    __weak typeof(self) weakSelf = self;
    [self.nameL mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.centerX.mas_equalTo(weakSelf.contentView.mas_centerX);
//        make.centerY.mas_equalTo(weakSelf.contentView.mas_centerY).with.offset(jisuan(30));
        make.centerY.mas_equalTo(weakSelf.contentView.mas_centerY).with.offset(jisuan(40));
//        make.bottom.mas_equalTo(weakSelf.contentView.mas_bottom).with.offset(-jisuan(40));

    }];
    
    [self.iconIV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.bottom.mas_equalTo(weakSelf.nameL.mas_top).with.offset(-Margin);
        make.centerX.mas_equalTo(weakSelf.contentView.mas_centerX);
        make.width.mas_equalTo(jisuan(55));
        make.height.mas_equalTo(jisuan(55));
    }];
    
}

#pragma mark -lazy
- (UILabel *)nameL {
    
    if (!_nameL) {
        
        _nameL = [[UILabel alloc] init];
        _nameL.textColor = Color333333;
        _nameL.font = Font(24);
        _nameL.textAlignment = NSTextAlignmentCenter;
        
    }
    
    return _nameL;
}

- (UIImageView *)iconIV {
    
    if (!_iconIV) {
        
        _iconIV = [[UIImageView alloc] init];
        _iconIV.contentMode = UIViewContentModeScaleAspectFit;
    }
    
    return _iconIV;
}

@end
